<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;

class GrowController extends Controller
{
   public function run(){
        $today = date('Y-m-d');
        $tasks = DB::table('tasks')->where( 'enddate' ,'>=' ,$today )->get();
        //print_r($tasks);exit;
        foreach($tasks as $t){
           
             $t->paytime = $today;
             $t = (array)$t;
             unset($t['tid']);
             unset($t['enddate']);

             DB::table('grows')->insert($t);
          }
     }
}
